﻿using ESRI.ArcGIS.Geometry;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System;
namespace MapFormsApp.Models
{
    /// <summary>
    /// 路径规划结果模型
    /// </summary>
    public class RouteResult : IDisposable
    {
        public IPolyline PathGeometry { get; set; }
        public double TotalDistance { get; set; } // 单位：米
        public double TotalTime { get; set; }    // 单位：分钟
        public List<PathSegment> Segments { get; set; }
        public bool IsSuccess { get; set; }
        public string ErrorMessage { get; set; }

        public void Dispose()
        {
            if (PathGeometry != null && Marshal.IsComObject(PathGeometry))
            {
                Marshal.ReleaseComObject(PathGeometry);
                PathGeometry = null;
            }
        }
    }

}